<?php

use think\facade\Route;
use app\common\middleware\AdminAuthMiddleware;
use app\common\middleware\AdminTokenMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;

Route::group(function () {

    //活动
    Route::group('system/new/activity', function () {
        Route::get('lst', '/getList')->name('systemActivityLst')->option([
            '_alias' => '活动列表',
        ]);
        Route::post('create', '/create')->name('systemActivityCreate')->option([
            '_alias' => '活动添加',
        ]);
        Route::post('update/:id', '/update')->name('systemActivityUpdate')->option([
            '_alias' => '活动编辑',
        ]);
        Route::delete('delete/:id', '/delete')->name('systemActivityDelete')->option([
            '_alias' => '活动删除',
        ]);
        Route::get('detail/:id', '/detail')->name('systemActivityDetail')->option([
            '_alias' => '活动详情',
        ]);
        Route::post('status/:id', '/switchStatus')->name('systemActivityStatus')->option([
            '_alias' => '活动修改状态',
        ]);

        Route::get('claim_record', '/claimRecord')->name('systemActivityClaimRecord')->option([
            '_alias' => '领取记录',
        ]);
    })->prefix('admin.activity.NewActivity')->option([
        '_path' => '/cms/article',
        '_auth' => true,
        '_append'=> [
            [
                '_name'  =>'uploadImage',
                '_path'  =>'/cms/article',
                '_alias' => '上传图片',
                '_auth'  => true,
            ],
            [
                '_name'  =>'systemAttachmentLst',
                '_path'  =>'/cms/article',
                '_alias' => '素材列表',
                '_auth'  => true,
            ],
        ]
    ]);

    //活动商品
    Route::group('system/new/activity/product', function () {
        Route::get('lst', '/getList')->name('systemActivityProductLst')->option([
            '_alias' => '活动商品列表',
        ]);
        Route::post('status', '/switchAudit')->name('systemActivityProductSwitchAudit')->option([
            '_alias' => '审核',
        ]);
        Route::post('show/:id', '/switchStatus')->name('systemActivityProductSwitchStatus')->option([
            '_alias' => '显示/隐藏',
        ]);

    })->prefix('admin.activity.NewActivityProduct');

})->middleware(AllowOriginMiddleware::class)
    ->middleware(AdminTokenMiddleware::class, true)
    ->middleware(AdminAuthMiddleware::class)
    ->middleware(LogMiddleware::class);
